home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / SoundPlayerBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  9KB  |  259 lines

  1. package symantec.itools.multimedia;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/19/98    LAB    Moved to GroupAWTMultimedia folder.
  8.  
  9. /**
  10.  * BeanInfo for SoundPlayer.
  11.  *
  12.  */
  13.  
  14. public class SoundPlayerBeanInfo extends SimpleBeanInfo {
  15.  
  16.     /**
  17.      * Constructs a SoundPlayerBeanInfo object.
  18.      */
  19.     public SoundPlayerBeanInfo() {
  20.     }
  21.  
  22.     /**
  23.      * Gets a BeanInfo for the superclass of this bean.
  24.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  25.      */
  26.     public BeanInfo[] getAdditionalBeanInfo() {
  27.         try {
  28.             BeanInfo[] bi = new BeanInfo[1];
  29.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  30.             return bi;
  31.         }
  32.         catch (IntrospectionException e) { throw new Error(e.toString());}
  33.     }
  34.  
  35.     /**
  36.      * Gets the SymantecBeanDescriptor for this bean.
  37.      * @return an object of type SymantecBeanDescriptor
  38.      * @see symantec.itools.beans.SymantecBeanDescriptor
  39.      */
  40.     public BeanDescriptor getBeanDescriptor() {
  41.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  42.         String s=group.getString("GroupAWTMultimedia"); 
  43.  
  44.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  45.         bd.setFlags("invisible");
  46.         bd.setWinHelp("0x1238D");
  47.         bd.setFolder(s);
  48.         bd.setToolbar(s);
  49.  
  50.         return (BeanDescriptor) bd;
  51.     }
  52.  
  53.     /**
  54.      * Gets an image that may be used to visually represent this bean
  55.      * (in the toolbar, on a form, etc).
  56.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  57.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  58.      * @return an image for this bean, always color even if requested monochrome
  59.      * @see BeanInfo#ICON_MONO_16x16
  60.      * @see BeanInfo#ICON_COLOR_16x16
  61.      * @see BeanInfo#ICON_MONO_32x32
  62.      * @see BeanInfo#ICON_COLOR_32x32
  63.      */
  64.     public java.awt.Image getIcon(int iconKind) {
  65.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  66.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  67.             java.awt.Image img = loadImage("SoundPlayerC16.gif");
  68.             return img;
  69.         }
  70.  
  71.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  72.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  73.             java.awt.Image img = loadImage("SoundPlayerC32.gif");
  74.             return img;
  75.         }
  76.  
  77.         return null;
  78.     }
  79.  
  80.     /**
  81.      * Gets an array of descriptions of the methods used for "connections" by
  82.      * Visual CafΘ's Interaction Wizard.
  83.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  84.      * @return method descriptions for this bean
  85.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  86.      */
  87.     public MethodDescriptor[] getMethodDescriptors() {
  88.         Class[] args;
  89.         ConnectionDescriptor connection;
  90.         java.util.Vector connections;
  91.         java.util.Vector md = new java.util.Vector();
  92.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  93.  
  94.         try{
  95.             args = new Class[1];
  96.             args[0] = java.lang.String.class ;
  97.             MethodDescriptor addStringURL = new MethodDescriptor(beanClass.getMethod("addStringURL", args));
  98.  
  99.             connections = new java.util.Vector();
  100.             connection = new ConnectionDescriptor("input", "String", "",
  101.                                     "%name%.addStringURL(%arg%);",
  102.                                     conn.getString("addStringURL"));
  103.             connections.addElement(connection);
  104.  
  105.             addStringURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  106.             md.addElement(addStringURL);
  107.         } catch (Exception e) { throw new Error("addStringURL:: " + e.toString()); }
  108.  
  109.         try{
  110.             args = null;
  111.             MethodDescriptor getRepeat = new MethodDescriptor(beanClass.getMethod("getRepeat", args));
  112.  
  113.             connections = new java.util.Vector();
  114.             connection = new ConnectionDescriptor("output", "int", "",
  115.                                     "%name%.getRepeat()",
  116.                                     conn.getString("getRepeat"));
  117.             connections.addElement(connection);
  118.  
  119.             getRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  120.             md.addElement(getRepeat);
  121.         } catch (Exception e) { throw new Error("getRepeat:: " + e.toString()); }
  122.  
  123.         try{
  124.             args = null;
  125.             MethodDescriptor isSyncMode = new MethodDescriptor(beanClass.getMethod("isSyncMode", args));
  126.  
  127.             connections = new java.util.Vector();
  128.             connection = new ConnectionDescriptor("output", "boolean", "",
  129.                                     "%name%.isSyncMode()",
  130.                                     conn.getString("isSyncMode"));
  131.             connections.addElement(connection);
  132.  
  133.             isSyncMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  134.             md.addElement(isSyncMode);
  135.         } catch (Exception e) { throw new Error("isSyncMode:: " + e.toString()); }
  136.  
  137.         try{
  138.             args = new Class[1];
  139.             args[0] = java.lang.Boolean.TYPE ;
  140.             MethodDescriptor setSyncMode = new MethodDescriptor(beanClass.getMethod("setSyncMode", args));
  141.  
  142.             connections = new java.util.Vector();
  143.             connection = new ConnectionDescriptor("input", "boolean", "",
  144.                                     "%name%.setSyncMode(%arg%);",
  145.                                     conn.getString("setSyncMode"));
  146.             connections.addElement(connection);
  147.  
  148.             setSyncMode.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  149.             md.addElement(setSyncMode);
  150.         } catch (Exception e) { throw new Error("setSyncMode:: " + e.toString()); }
  151.  
  152.         try{
  153.             args = null;
  154.             MethodDescriptor stop = new MethodDescriptor(beanClass.getMethod("stop", args));
  155.  
  156.             connections = new java.util.Vector();
  157.             connection = new ConnectionDescriptor("input", "void", "",
  158.                                     "%name%.stop();",
  159.                                     conn.getString("stopSP"));
  160.             connections.addElement(connection);
  161.  
  162.             connection = new ConnectionDescriptor("input", "int", "",
  163.                                     "%name%.stop(%arg%);",
  164.                                     conn.getString("stopSPDelay"));
  165.             connections.addElement(connection);
  166.  
  167.             stop.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  168.             md.addElement(stop);
  169.         } catch (Exception e) { throw new Error("stop:: " + e.toString()); }
  170.  
  171.         try{
  172.             args = new Class[1];
  173.             args[0] = java.lang.Integer.TYPE ;
  174.             MethodDescriptor setRepeat = new MethodDescriptor(beanClass.getMethod("setRepeat", args));
  175.  
  176.             connections = new java.util.Vector();
  177.             connection = new ConnectionDescriptor("input", "int", "",
  178.                                     "%name%.setRepeat(%arg%);",
  179.                                     conn.getString("setRepeatSP"));
  180.             connections.addElement(connection);
  181.  
  182.             setRepeat.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  183.             md.addElement(setRepeat);
  184.         } catch (Exception e) { throw new Error("setRepeat:: " + e.toString()); }
  185.  
  186.         try{
  187.             args = null;
  188.             MethodDescriptor play = new MethodDescriptor(beanClass.getMethod("play", args));
  189.  
  190.             connections = new java.util.Vector();
  191.             connection = new ConnectionDescriptor("input", "void", "",
  192.                                     "%name%.play();",
  193.                                     conn.getString("play"));
  194.             connections.addElement(connection);
  195.  
  196.             play.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  197.             md.addElement(play);
  198.         } catch (Exception e) { throw new Error("play:: " + e.toString()); }
  199.  
  200.         try{
  201.             args = new Class[1];
  202.             args[0] = java.net.URL.class ;
  203.             MethodDescriptor addURL = new MethodDescriptor(beanClass.getMethod("addURL", args));
  204.  
  205.             connections = new java.util.Vector();
  206.             connection = new ConnectionDescriptor("input", "RelativeURL", "",
  207.                                     "%name%.addURL(symantec.itools.net.RelativeURL.getURL(%arg%));",
  208.                                     conn.getString("addURLRelative"));
  209.             connections.addElement(connection);
  210.  
  211.             connection = new ConnectionDescriptor("input", "URL", "",
  212.                                     "%name%.addURL(%arg%);",
  213.                                     conn.getString("addURL"));
  214.             connections.addElement(connection);
  215.  
  216.             addURL.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  217.             md.addElement(addURL);
  218.         } catch (Exception e) { throw new Error("addURL:: " + e.toString()); }
  219.  
  220.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  221.         md.copyInto(rv);
  222.  
  223.         return rv;
  224.     }
  225.  
  226.     /**
  227.      * Returns descriptions of this bean's properties.
  228.      */
  229.     public PropertyDescriptor[] getPropertyDescriptors() {
  230.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  231.  
  232.         try{
  233.         PropertyDescriptor syncMode = new PropertyDescriptor("syncMode", beanClass);
  234.         syncMode.setBound(true);
  235.         syncMode.setConstrained(true);
  236.         syncMode.setDisplayName(prop.getString("syncMode"));
  237.  
  238.         PropertyDescriptor repeat = new PropertyDescriptor("repeat", beanClass);
  239.         repeat.setBound(true);
  240.         repeat.setConstrained(true);
  241.         repeat.setDisplayName(prop.getString("repeatSP"));
  242.  
  243.         PropertyDescriptor uRLList = new PropertyDescriptor("uRLList", beanClass);
  244.         uRLList.setBound(true);
  245.         uRLList.setConstrained(true);
  246.         uRLList.setDisplayName(prop.getString("uRLList"));
  247.         uRLList.setValue("URLFILTER", prop.getString("soundURLFILTER"));
  248.  
  249.         PropertyDescriptor[] rv = {
  250.             syncMode,
  251.             repeat,
  252.             uRLList};
  253.         return rv;
  254.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  255.     }
  256.  
  257.     private final static Class beanClass = SoundPlayer.class;
  258.  
  259.     }    //  end of class SoundPlayerBeanInfo